﻿@model LY.Manage.Model.Department

@{
    Layout = null;
}
@using LY.Manage.Model
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />

    <title>添加用户</title>
    <!--引入文件-->
    <link href="~/Content/themes/default/easyui.css" rel="stylesheet" />
    <link href="~/Content/themes/icon.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.8.2.min.js"></script>
    <script src="~/Scripts/jquery.easyui.min.js"></script>
    <script src="~/Scripts/easyui-lang-zh_CN.js"></script>
    <script src="~/Scripts/datapattern.js"></script>
    <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    <script src="~/Scripts/jquery.validate.min.js"></script>
    <link href="~/Content/BaseStyle.css" rel="stylesheet" />

    <script type="text/javascript">
        //获取url中的参数
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
        }
        $(function () {
            console.log(getUrlParam("ObjectId"));
            $('#ObjectId').val(getUrlParam("ObjectId"));
        });

        function subForm() {
            console.log("subForm--提交数据")
            $("#fmMain").submit();
        }
        function afterAdd(data) {
            console.log("sub-after-add:" + data);
            //调用父窗体中的方法
            window.parent.afterAdd(data);
        }
    </script>
</head>
<body>

       @using (Ajax.BeginForm("AddUserInfo", "UserInfo", new { }, new AjaxOptions()
{
    HttpMethod = "post",
    OnSuccess = "afterAdd"
}, new { id = "fmMain" }))
    {
                @Html.AntiForgeryToken()
                @Html.ValidationSummary(true)



                <input type="hidden" id="ObjectId" name="ObjectId" />
           
             <table>
                    <tr><td>用户名</td><td><input type="text" name="UName" /></td></tr>
                    <tr><td>密码</td><td><input type="password" name="UPwd" /></td></tr>
                    <tr><td>部门</td><td>
                      @Html.DropDownList("DepName", ViewBag.DevNameList as IEnumerable<SelectListItem>)
                        
                       @*@Html.DropDownListFor( model => model.ID, ViewBag.DevNameList as IEnumerable<SelectListItem>, new { @class = "form-control" })*@
                        </td></tr>
                    <tr><td>备注</td><td><input type="text" name="Remark" /></td></tr>
                    <tr><td>排序</td><td><input type="text" name="Sort" /></td></tr>
                </table>
           
           
           
            
    }

          
        </body>
        </html>
